{% extends 'virtualization/virtualmachine/base.html' %}
{% load render_table from django_tables2 %}
{% load helpers %}

{% block content %}
  <form method="post">
    {% csrf_token %}
    {% include 'inc/table_controls_htmx.html' with table_modal="VirtualMachineVMInterfaceTable_config" %}

    <div class="card">
      <div class="card-body" id="object_list">
        {% include 'htmx/table.html' %}
      </div>
    </div>

    <div class="noprint">
        {% if perms.virtualization.change_vminterface %}
            <button type="submit" name="_rename" formaction="{% url 'virtualization:vminterface_bulk_rename' %}?return_url={% url 'virtualization:virtualmachine_interfaces' pk=object.pk %}" class="btn btn-warning btn-sm">
                <span class="mdi mdi-pencil" aria-hidden="true"></span> Rename
            </button>
            <button type="submit" name="_edit" formaction="{% url 'virtualization:vminterface_bulk_edit' %}?virtual_machine={{ object.pk }}&return_url={% url 'virtualization:virtualmachine_interfaces' pk=object.pk %}" class="btn btn-warning btn-sm">
                <span class="mdi mdi-pencil" aria-hidden="true"></span> Edit
            </button>
        {% endif %}
        {% if perms.virtualization.delete_vminterface %}
            <button type="submit" name="_delete" formaction="{% url 'virtualization:vminterface_bulk_delete' %}?return_url={% url 'virtualization:virtualmachine_interfaces' pk=object.pk %}" class="btn btn-danger btn-sm">
                <span class="mdi mdi-trash-can-outline" aria-hidden="true"></span> Delete
            </button>
        {% endif %}
        {% if perms.virtualization.add_vminterface %}
            <div class="float-end">
                <a href="{% url 'virtualization:vminterface_add' %}?virtual_machine={{ object.pk }}&return_url={% url 'virtualization:virtualmachine_interfaces' pk=object.pk %}" class="btn btn-primary btn-sm">
                    <span class="mdi mdi-plus-thick" aria-hidden="true"></span> Add interfaces
                </a>
            </div>
        {% endif %}
        <div class="clearfix"></div>
     </div>
  </form>
{% endblock content %}

{% block modals %}
  {{ block.super }}
  {% table_config_form table %}
{% endblock modals %}
